package com.qf.collection;

import com.qf.collection.MyCollection02;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

public class Demo02 {
    public static void main(String[] args) {

        MyCollection02 arr = new MyCollection02();

//        System.out.println(arr.isEmpty());

        arr.add("hello");
//        System.out.println(arr.size());
        arr.add("world");
//        System.out.println(arr.size());
        arr.add("1324");
//        System.out.println(arr.size());


//        System.out.println(arr.isEmpty());

        Collection<Object> objects = new ArrayList<>();
        objects.add("hello");
        objects.add("world");
        objects.add("qwer");

//        arr.addAll(objects);
//
//        System.out.println(arr);
//        arr.remove("hello");
//        arr.removeAll(objects);
//
//        Object[] objects1 = new Object[arr.size()];
//        System.out.println(Arrays.toString(arr.toArray(objects1)));


//        System.out.println(arr.contains("hello"));
//        System.out.println(arr.contains("world"));
//        System.out.println(arr.contains("qwer"));
//        System.out.println(arr.containsAll(objects));


//        System.out.println(arr.retainAll(objects));

        Iterator iterator = arr.iterator();
        while (iterator.hasNext()) {
            Object next = iterator.next();
            System.out.println(next);
        }

        System.out.println(arr);
    }
}
